const mysql = require('mysql2/promise');
const config = require('./database-config.js');

async function addGoldToCharacter() {
  const connection = await mysql.createConnection(config.source);
  
  console.log('💰 为角色添加金币...');
  
  try {
    // 为角色2007添加金币
    await connection.execute('UPDATE character_resources SET gold = 100000 WHERE characterId = 2007');
    console.log('✅ 已为角色2007添加100000金币');
    
    // 查询角色资源信息
    const [resources] = await connection.execute('SELECT characterId, gold, silver FROM character_resources WHERE characterId = 2007');
    if (resources.length > 0) {
      console.log(`📊 角色2007资源: 金币=${resources[0].gold}, 银两=${resources[0].silver}`);
    }
    
  } catch (error) {
    console.error('❌ 添加金币失败:', error.message);
  } finally {
    await connection.end();
  }
}

addGoldToCharacter();
